import java.util.Scanner;

public class Test {

    public static void move(char pos1, char pos2) {
        System.out.println(pos1 +"->"+ pos2);
    }
    public static void hanio(int n, char pos1, char pos2, char pos3) {
        if(n == 1) {
            move(pos1, pos3);
        }
        else {
            hanio(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            hanio(n-1,pos2,pos1,pos3);
        }
    }
    public static void main(String[] args) {
        //递归求解汉诺塔问题
        Scanner sca = new Scanner(System.in);
        int n = sca.nextInt();
        hanio(n, 'A', 'B', 'C');
    }
    public static void max(int n1,int n2) {
        if(n1 < n2) {
            System.out.println(n2 +"是"+ n1 +"和"+ n2 +"的最大值");
        }
        else {
            System.out.println(n1 +"是"+ n1 +"和"+ n2 +"的最大值");
        }
    }
    public static void max(double f1,double f2,double f3) {
        double m = f1;
        if(m < f2) {
            m = f2;
        }
        if(m < f3) {
            m = f3;
        }
        System.out.println(m +"是"+ f1 +" "+ f2 +" "+ f3 +"的最大值");
    }
    public static void main3(String[] args) {
        Scanner sca = new Scanner(System.in);
        int n1 = sca.nextInt();
        int n2 = sca.nextInt();
        max(n1, n2);
        double f1 = sca.nextDouble();
        double f2 = sca.nextDouble();
        double f3 = sca.nextDouble();
        max(f1, f2, f3);
    }
    public static void add(int a,int b) {
        int c = a + b;
        System.out.println(c +"是"+ a +" "+ b +"的和");
    }
    public static void add(double f1,double f2,double f3) {
        double f = f1 + f2 + f3;
        System.out.println(f +"是"+ f1 +" "+ f2 +" "+ f3 +"的和");
    }
    public static void main2(String[] args) {
        Scanner sca = new Scanner(System.in);
        int a = sca.nextInt();
        int b = sca.nextInt();
        add(a, b);
        double f1 = sca.nextDouble();
        double f2 = sca.nextDouble();
        double f3 = sca.nextDouble();
        add(f1, f2, f3);
    }
    public static void max3(int max,int n3) {
        if(max < n3) {
            System.out.println(n3 +"是整个的最大值");
        }
        else {
            System.out.println(max +"是整个的最大值");
        }
    }
    public static void max2(int n1,int n2,int n3) {
        int max = 0;
        if(n1 < n2) {
            max = n2;
            System.out.println(max +"是"+ n1 +" "+ n2 +"的最大值");
        }
        else {
            max = n1;
            System.out.println(max +"是"+ n1 +" "+ n2 +"的最大值");
        }
        max3(max,n3);
    }
    public static void main1(String[] args) {
        Scanner sca = new Scanner(System.in);
        int n1 = sca.nextInt();
        int n2 = sca.nextInt();
        int n3 = sca.nextInt();
        max2(n1,n2,n3);

    }
}
